<?php

namespace App\Http\Controllers\Api\User;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Facades\Utils\ValidateParameter;
use App\Facades\Service\User\ReceiveMessageService;

class ReceiveMessageController extends Controller
{
    public function receive(Request $request){

         $rules = [
            'openid' => 'required|exists:wechat_users,openid',
            'message' => 'required'
        ];

        ValidateParameter::validate($request,$rules);

        $data= $request->all();

        ReceiveMessageService::receiveMessage($data);

        return formatJsonResponse();
    }
}
